package com.wangsd.common.exception;

public enum BusinessErrorEnum implements BusinessError{
    //1000开头为通用错误类型
    UNKNOWN_ERROR(10001, "通用错误"),
    OUT_ERROR(10002, "接收外部错误信息"),
    PARAMETER_VALIDATION_ERROR(10003, "参数不合法"),
    ALREADY_IN_USE(10004, "该名称已被占用"),

    FILE_SIZE_LIMIT(30001, "上传的文件大小超出限制的文件大小"),
    FILE_NAME_LENGTH_LIMIT(30002, "文件名太长"),

    //2000开头为用户信息相关错误定义
    USER_NOT_EXIST(20001, "用户不存在"),
    USER_ACCOUNT_OR_PASSWORD_ERROR(20002, "账号或密码错误"),
    USER_NO_PERMISSION(20003, "没有权限非法访问"),
    USER_DISABLE(20004, "用户被禁用"),
    USER_JCAPTCHA_EXPIRE(20004, "验证码已失效"),
    USER_JCAPTCHA_ERROR(20005, "验证码错误"),
    USER_PAYOENPIE_ERROR(29999, "用户还未授权请先授权"),

    PRODUCT_NUM_EXIST(30001, "商品数量不足！")
    ;

    BusinessErrorEnum(int errCode, String errMessage) {
        this.errCode = errCode;
        this.errMessage = errMessage;
    }

    private int errCode;
    private String errMessage;

    @Override
    public int getErrCode() {
        return errCode;
    }

    @Override
    public String getErrMessage() {
        return errMessage;
    }

    @Override
    public BusinessError setErrMessage(String message) {
        this.errMessage = message;
        return this;
    }
}
